package dto

import (

	"go-admin/app/admin/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
)

type FavoritesGetPageReq struct {
	dto.Pagination     `search:"-"`
    UserId int64 `form:"userId"  search:"type:exact;column:user_id;table:favorites" comment:"用户ID"`
    AdvertisementId int64 `form:"advertisementId"  search:"type:exact;column:advertisement_id;table:favorites" comment:"广告ID"`
    FavoritesOrder
}

type FavoritesOrder struct {
    Id string `form:"idOrder"  search:"type:order;column:id;table:favorites"`
    UserId string `form:"userIdOrder"  search:"type:order;column:user_id;table:favorites"`
    AdvertisementId string `form:"advertisementIdOrder"  search:"type:order;column:advertisement_id;table:favorites"`
    CreateBy string `form:"createByOrder"  search:"type:order;column:create_by;table:favorites"`
    UpdateBy string `form:"updateByOrder"  search:"type:order;column:update_by;table:favorites"`
    CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:favorites"`
    UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:favorites"`
    DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:favorites"`
    
}

func (m *FavoritesGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type FavoritesInsertReq struct {
    Id int `json:"-" comment:""` // 
    UserId int64 `json:"userId" comment:"用户ID"`
    AdvertisementId int64 `json:"advertisementId" comment:"广告ID"`
    common.ControlBy
}

func (s *FavoritesInsertReq) Generate(model *models.Favorites)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.UserId = s.UserId
    model.AdvertisementId = s.AdvertisementId
    model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

func (s *FavoritesInsertReq) GetId() interface{} {
	return s.Id
}

type FavoritesUpdateReq struct {
    Id int `uri:"id" comment:""` // 
    UserId int64 `json:"userId" comment:"用户ID"`
    AdvertisementId int64 `json:"advertisementId" comment:"广告ID"`
    common.ControlBy
}

func (s *FavoritesUpdateReq) Generate(model *models.Favorites)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.UserId = s.UserId
    model.AdvertisementId = s.AdvertisementId
    model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

func (s *FavoritesUpdateReq) GetId() interface{} {
	return s.Id
}

// FavoritesGetReq 功能获取请求参数
type FavoritesGetReq struct {
     Id int `uri:"id"`
}
func (s *FavoritesGetReq) GetId() interface{} {
	return s.Id
}

// FavoritesDeleteReq 功能删除请求参数
type FavoritesDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *FavoritesDeleteReq) GetId() interface{} {
	return s.Ids
}
